package com.sinaapp.gavinzhang.webserver;

import javax.servlet.*;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by gavin on 15-8-14.
 */
public class HelloServlet implements Servlet {
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("helloServelt init");
    }

    public ServletConfig getServletConfig() {
        return null;
    }

    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("hrlloServlet Service");
        PrintWriter writer = servletResponse.getWriter();
        writer.println("println ok");
        writer.write("it is ok");
        writer.flush();

    }

    public String getServletInfo() {
        return null;
    }

    public void destroy() {
        System.out.println("helloServlet destroy");
    }
}
